<!--
 * @Description: 学员基本信息
 * @Autor: dyx
 * @Date: 2023-03-03 12:04:41
 * @LastEditTime: 2023-07-10 21:41:01
-->
<template>
  <div class="basicInformation">
    <div class="min_title">
      <i class="icon-ym icon-ym-gangwei2"></i>
      <h3>基本信息</h3>
    </div>
    <table>
      <tr>
        <td>姓名</td>
        <td>{{ dataForm.studentname }}</td>
        <td>身份证</td>
        <td>{{ dataForm.certificatesnumber }}</td>
        <td rowspan="5" class="photo">
          <img :src="avatar" alt="" />
        </td>
      </tr>
      <tr>
        <td>性别</td>
        <td v-if="dataForm.gender">{{ getDict("sex", dataForm.gender) }}</td>
        <td>手机号码</td>
        <td>{{ dataForm.mobilephone }}</td>
      </tr>
      <tr>
        <td>单位名称</td>
        <td>{{ dataForm.company }}</td>
        <td>单位类型</td>
        <td v-if="dataForm.companytype">
          {{ getDict("dwType", dataForm.companytype) }}
        </td>
      </tr>
      <tr>
        <td>人员类型</td>
        <td v-if="dataForm.persontype">
          {{ getDict("personType", dataForm.persontype) }}
        </td>
        <td>科室/部门</td>
        <td>{{ dataForm.department }}</td>
      </tr>
      <tr>
        <td>学历</td>
        <td v-if="dataForm.education">
          {{ getDict("Education", dataForm.education) }}
        </td>
        <td>职称</td>
        <td>{{ dataForm.title }}</td>
      </tr>
    </table>

    <div class="min_title">
      <i class="icon-ym icon-ym-file-blank"></i>
      <h3>附件</h3>
    </div>

    <el-row class="JADP-common-search-box" :gutter="15">
      <el-form :model="dataForm" label-position="right">
        <el-col :span="13">
          <el-form-item label="登记表附件：" prop="registration">
            <JADP-UploadFz v-model="registrationList" disabled> </JADP-UploadFz>
          </el-form-item>
        </el-col>

        <el-col :span="13">
          <el-form-item label="学历证明附件：" prop="academic">
            <JADP-UploadFz v-model="academicList" disabled> </JADP-UploadFz>
          </el-form-item>
        </el-col>

        <el-col :span="13">
          <el-form-item label="身份证附件：" prop="idcard">
            <JADP-UploadImg v-model="idcardList" disabled> </JADP-UploadImg>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="学员照片：" prop="photo">
            <JADP-UploadImg v-model="photoList" disabled> </JADP-UploadImg>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
import request from "@/utils/request";
export default {
  name: "basicInformation",
  inject: ["stuid"],
  data() {
    return {
      dataForm: {
        registration: "",
        academic: "",
        idcard: "",
        photo: ""
      },
      registrationList: [],
      academicList: [],
      idcardList: [],
      photoList: [],
      avatar: ""
    };
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      this.$nextTick(() => {
        request({
          url:
            "/api/xy_da_student_archives/Xy_da_student_archives/" +
            this.stuid.id+`?organizeId=${this.$store.getters.organizeId}`,
          method: "get"
        }).then(res => {
          this.dataForm = res.data;
          console.log(this.dataForm, " this.dataForm");
          this.registrationList = res.data.registration
            ? JSON.parse(res.data.registration)
            : [];
          this.academicList = res.data.academic
            ? JSON.parse(res.data.academic)
            : [];
          this.idcardList = res.data.idcard ? JSON.parse(res.data.idcard) : [];
          this.photoList = res.data.photo ? JSON.parse(res.data.photo) : [];
          console.log(this.photoList, " this.photoList");
          this.avatar = this.photoList.length ? this.photoList[0].url : "";
        });
      });
    }
  }
};
</script>
<style scoped lang="scss">
.basicInformation {
  padding: 5px 20px;
  height: 78vh;
  overflow-y: auto;
  .min_title {
    display: flex;
    height: 40px;
    line-height: 40px;
    font-weight: bold;
    border-bottom: 1px solid #ebeef5;
    margin: 10px 0;
    text-indent: 10px;
    i {
      font-size: 24px;
    }
  }
  table {
    width: 100%;
    border-collapse: collapse;
    tr {
      height: 45px;
      td {
        border: 2px solid #ebeef5;
        text-align: center;
      }
      .photo {
        width: 200px;
        height: 225px;
        background-color: #ccc;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>
